package com.hfi.security.core.validate.code;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author ChangLiang
 * @date 2019/8/13
 */
public class ValidateCode implements Serializable {

    private String code;

    /**
     * 存储的时候 存储真正的一个时间点
     */
    private LocalDateTime expireTime;

    /**
     * 构造的时候 传一个秒数
     * @param code
     * @param expireTime 比如60秒过期
     */
    public ValidateCode(String code, int expireTime) {
        this.code = code;
        this.expireTime = LocalDateTime.now().plusSeconds(expireTime);
    }

    public ValidateCode(String code, LocalDateTime expireTime) {
        this.code = code;
        this.expireTime = expireTime;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }
}
